package com.gxa.service.Statistic.impl;

import com.gxa.dao.statistic.StatisticMapper;
import com.gxa.pojo.Statistic.StatisticSell;
import com.gxa.service.Statistic.StatisticService;
import com.gxa.util.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import java.util.Date;
import java.util.List;

public class StatisticServiceimpl implements StatisticService {


    @Override
    public List<StatisticSell> selectyears(String year) {
        SqlSessionFactory sqlSessionFactory = SqlSessionFactoryUtils.getSqlSessionFactory();
        SqlSession sqlSession = sqlSessionFactory.openSession(true);
        StatisticMapper mapper = sqlSession.getMapper(StatisticMapper.class);

        List<StatisticSell> selectyears = mapper.selectyears(year);

        return selectyears;
    }

    @Override
    public List<StatisticSell> selectyearsBYUser(String year, String user) {
        SqlSessionFactory sqlSessionFactory = SqlSessionFactoryUtils.getSqlSessionFactory();
        SqlSession sqlSession = sqlSessionFactory.openSession(true);
        StatisticMapper mapper = sqlSession.getMapper(StatisticMapper.class);
        List<StatisticSell> statisticSells = mapper.selectyearsBYUser(year, user);
        return statisticSells;
    }
}
